<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>成交记录</title>
<meta name="viewport" content="width=100%, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/lib/weix/style/weui.min.css">
<link rel="stylesheet" href="/css/fonts.css">
<link rel="stylesheet" href="/css/comm.css">
<link rel="stylesheet" href="/css/list_hej.css">
</head>

<body>
<div id="J_list">

</div>

<div class="weui-loadmore" id="J_loadmore">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>


<script src="/js/zepto.min.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="/js/comm.js"></script>
<script type="text/javascript">
function getCustomerList(page){
	var uid = "${uid}";
	var data = {page:page,rows:100,uid:uid,returnType:1};
	var url = '';
	var topen_data= GetQueryString('topen')
	
	
	//开单员看到自己开单记录  	topen_data = 1
	//合伙人看到自己报备的收益	topen_data = 2 
	//管理员看到所有的开单记录	topen_data = 3
	
	if(topen_data == 1 || topen_data == 3){
		$('title').html('开单记录')
		url = "/order/getDealOrder";
	}else if(topen_data == 2){
		$('title').html('成交记录')
		url = "/order/order_list";
	}
	
	$('#J_loadmore').show()
	
	$.ajax({
		type: "POST",
		dataType: 'json',
		async: false,
		contentType: "application/json; charset=utf-8",
		data: JSON.stringify(data),
		url: url,
		success: function(res){
			if(res.code = "200"){
				//操作
				var list = res.data.list;
				//console.log(list);
				for(var i in list) {
					
					var shtml = '<div class="th-date__boxs"><div class="th-date__box J_date_box"><span class="tit max">'+i+'</span><span class="more max"></span></div></div>'+
								'<div class="weui-cells top_no lib J_wxpic_show">'
								
					var lists =  list[i];
					for (var j =0;j<lists.length;j++){
						
					shtml +='<div class="weui-cell weui-cell_access">'+
								'<a class="weui-cell__hd tb" style="color:#f52e00" href="/orderPage/order/'+lists[j]['id']+'"><i class="icon-money"></i></a>'+
								'<a class="weui-cell__bd" href="/orderPage/order/'+lists[j]['id']+'">'+
									'<div class="th-info__tit">'+lists[j]['name']+'-'+lists[j]['address']+'</div>'
					if(topen_data == 1 || topen_data == 3){
					shtml +=		'<div class="th-info__fbt">奖励'+lists[j]['useName']+'<span class="red">'+lists[j]['points']+'</span>积分</div>'
					}else if(topen_data == 2){
					shtml +=		'<div class="th-info__fbt">获得<span class="red">'+lists[j]['points']+'</span>积分</div>'	
					}			
					shtml +=		'<div class="th-info__time">'+lists[j]['addtime']+'</div>'+
								'</a>'+
								'<a class="weui-cell__ft" href="/orderPage/order/'+lists[j]['id']+'">'+lists[j]['total_money']+'</a>'+
								'<div class="th-info__thumb"><img src="'+lists[j]['pic']+'" class="fd" /></div>'+
							'</div>'
					}
					
					shtml += '</div>'
					
					$('#J_list').append(shtml);
				};

			}else{
				weui.topTips(res.msg);
			}
		},
		error: function(e){

		},
		complete: function(e){
			$('#J_loadmore').hide()
			winxpic();
		}
	});

}

$(function(){	
	//--------------------------------------------------------------------------------
	//初始化
	getCustomerList(1);
	//--------------------------------------------------------------------------------
	//月份
	$(window).bind('scroll', function(){ 
		var scrollTop = document.body.scrollTop+document.documentElement.scrollTop;

		$('.J_date_box').each(function() {
        	var $this_t = $(this)
			var hig_t = $this_t.offset().top
			
			if(scrollTop > hig_t+5){
				$('.J_date_box').removeClass('fix')
				$this_t.addClass('fix')
			}else{
				$this_t.removeClass('fix')
			}
        });
	});
	
});
</script>
</body>
</html>